<?php

class Session{
    
    function __construct()
    {
        ini_set('memory_limit', '-1');
        set_time_limit(5000);
        //error_reporting(E_ALL ^ E_NOTICE);
        if(is_null($_COOKIE["session_id_usuario"])){
            session_start();
            $session_id=session_id();
            setcookie("session_id_usuario",$session_id);
        }else{
            $session_id = $_COOKIE["session_id_usuario"];
            session_id($session_id);
            session_start();
        }
        //session_start();
        //echo session_id();
    }
    
    function set_userdata($newdata = array(), $newval = '')
    {
        $_SESSION[$newdata]=$newval;
    }
    
    function userdata($item){
        return $_SESSION[$item];
    }
    
    function destroy(){
        session_destroy();
    }
}
?>
